home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / windows / wdj1096.zip / ZOLMAN.ZIP / MDIICONS.ZIP / ICONS.CPP < prev    next >
C/C++ Source or Header  |  1996-02-16  |  4KB  |  142 lines

  1. // icons.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "icons.h"
  6.  
  7. #include "mainfrm.h"
  8. #include "iconsdoc.h"
  9. #include "iconsvw.h"
  10.  
  11. #ifdef _DEBUG
  12. #undef THIS_FILE
  13. static char BASED_CODE THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CIconsApp
  18.  
  19. BEGIN_MESSAGE_MAP(CIconsApp, CWinApp)
  20.     //{{AFX_MSG_MAP(CIconsApp)
  21.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  22.         // NOTE - the ClassWizard will add and remove mapping macros here.
  23.         //    DO NOT EDIT what you see in these blocks of generated code!
  24.     //}}AFX_MSG_MAP
  25.     // Standard file based document commands
  26.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  27.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  28.     // Standard print setup command
  29.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  30. END_MESSAGE_MAP()
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CIconsApp construction
  34.  
  35. CIconsApp::CIconsApp()
  36. {
  37.     // TODO: add construction code here,
  38.     // Place all significant initialization in InitInstance
  39. }
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // The one and only CIconsApp object
  43.  
  44. CIconsApp NEAR theApp;
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CIconsApp initialization
  48.  
  49. BOOL CIconsApp::InitInstance()
  50. {
  51.     // Standard initialization
  52.     // If you are not using these features and wish to reduce the size
  53.     //  of your final executable, you should remove from the following
  54.     //  the specific initialization routines you do not need.
  55.  
  56.     SetDialogBkColor();        // Set dialog background color to gray
  57.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  58.  
  59.     // Register the application's document templates.  Document templates
  60.     //  serve as the connection between documents, frame windows and views.
  61.  
  62.     CMultiDocTemplate* pDocTemplate;
  63.     pDocTemplate = new CMultiDocTemplate(
  64.         IDR_ICONSTYPE,
  65.         RUNTIME_CLASS(CIconsDoc),
  66.         //RUNTIME_CLASS(CMDIChildWnd),        // standard MDI child frame
  67.         RUNTIME_CLASS(CChildIconWnd),      // customized MDI child frame
  68.         RUNTIME_CLASS(CIconsView));
  69.     AddDocTemplate(pDocTemplate);
  70.  
  71.     // create main MDI Frame window
  72.     CMainFrame* pMainFrame = new CMainFrame;
  73.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  74.         return FALSE;
  75.     m_pMainWnd = pMainFrame;
  76.  
  77.     // create a new (empty) document
  78.     OnFileNew();
  79.  
  80.     if (m_lpCmdLine[0] != '\0')
  81.     {
  82.         // TODO: add command line processing here
  83.     }
  84.  
  85.     // The main window has been initialized, so show and update it.
  86.     pMainFrame->ShowWindow(m_nCmdShow);
  87.     pMainFrame->UpdateWindow();
  88.  
  89.     return TRUE;
  90. }
  91.  
  92. /////////////////////////////////////////////////////////////////////////////
  93. // CAboutDlg dialog used for App About
  94.  
  95. class CAboutDlg : public CDialog
  96. {
  97. public:
  98.     CAboutDlg();
  99.  
  100. // Dialog Data
  101.     //{{AFX_DATA(CAboutDlg)
  102.     enum { IDD = IDD_ABOUTBOX };
  103.     //}}AFX_DATA
  104.  
  105. // Implementation
  106. protected:
  107.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  108.     //{{AFX_MSG(CAboutDlg)
  109.         // No message handlers
  110.     //}}AFX_MSG
  111.     DECLARE_MESSAGE_MAP()
  112. };
  113.  
  114. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  115. {
  116.     //{{AFX_DATA_INIT(CAboutDlg)
  117.     //}}AFX_DATA_INIT
  118. }
  119.  
  120. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  121. {
  122.     CDialog::DoDataExchange(pDX);
  123.     //{{AFX_DATA_MAP(CAboutDlg)
  124.     //}}AFX_DATA_MAP
  125. }
  126.  
  127. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  128.     //{{AFX_MSG_MAP(CAboutDlg)
  129.         // No message handlers
  130.     //}}AFX_MSG_MAP
  131. END_MESSAGE_MAP()
  132.  
  133. // App command to run the dialog
  134. void CIconsApp::OnAppAbout()
  135. {
  136.     CAboutDlg aboutDlg;
  137.     aboutDlg.DoModal();
  138. }
  139.  
  140. /////////////////////////////////////////////////////////////////////////////
  141. // CIconsApp commands
  142.